const articleRules = {
  position: [{ required: true, trigger: 'blur', message: '请选择文章板块' }],
  articleDate: [{ required: true, trigger: 'blur', message: '请选择文章日期' }],
  tag: [{ required: true, trigger: 'blur', message: '请输入文章标签' }],
  title: [{ required: true, trigger: 'blur', message: '请输入文章标题' }],
  articleSummary: [{ required: true, trigger: 'blur', message: '请输入文章概述' }],
  image: [{ required: true, trigger: 'blur', message: '请上传文章封面' }],
  content: [{ required: true, trigger: 'blur', message: '嘿！你还没编写文章正文哟' }]
}

const articleICRules = {
  title: [
    { required: true, trigger: 'blur', message: '请输入文章标题' },
    {
      trigger: 'blur',
      message: '请输入文章标题',
      validator: (rule, value, callback) => {
        if (value.trim() === '') {
          callback(new Error('请输入文章标题'))
        } else {
          callback()
        }
      }
    }
  ],
  articleSummary: [
    { required: true, trigger: 'blur', message: '请输入文章概述' },
    {
      min: 1,
      max: 150,
      trigger: 'blur',
      message: '文章概述字数需在1~150之间'
    },
    {
      trigger: 'blur',
      message: '请输入文章概述',
      validator: (rule, value, callback) => {
        if (value.trim() === '') {
          callback(new Error('请输入文章标题'))
        } else {
          callback()
        }
      }
    }
  ],
  type: [{ required: true, trigger: 'blur', message: '请输入文章类别' }],
  content: [
    { required: true, trigger: 'blur', message: '请输入文章正文' },
    {
      trigger: 'blur',
      message: '请输入正文',
      validator: (rule, value, callback) => {
        if (value.trim() === '') {
          callback(new Error('请输入文章标题'))
        } else {
          callback()
        }
      }
    }
  ],
  school: [{ required: true, trigger: 'blur', message: '请输入学校' }]
}

const caseICRules = {
  title: [{ required: true, trigger: 'blur', message: '请输入案例标题' }],
  type: [{ required: true, trigger: 'blur', message: '请输入案例类别' }],
  appealResult: [{ required: true, trigger: 'blur', message: '请输入申诉结果' }],
  articleSummary: [{ required: true, trigger: 'blur', message: '请输入案例概述' }],
  content: [{ required: true, trigger: 'blur', message: '请输入案例正文' }],
  school: [{ required: true, trigger: 'blur', message: '请输入学校' }],
  createTime: [{ required: true, trigger: 'blur', message: '请选择案例日期' }]

}

const videoRules = {
  title: [
    { required: true, trigger: 'blur', message: '请输入课程名称' },
    {
      trigger: 'blur',
      message: '请输入课程名称',
      validator: (rule, value, callback) => {
        if (value.trim() === '') {
          callback(new Error('请输入课程名称'))
        } else {
          callback()
        }
      }
    }
  ],
  summary: [
    { required: true, trigger: 'blur', message: '请输入课程概述' },
    {
      min: 1,
      max: 150,
      trigger: 'blur',
      message: '课程概述字数需在1~150之间'
    },
    {
      trigger: 'blur',
      message: '请输入课程概述',
      validator: (rule, value, callback) => {
        if (value.trim() === '') {
          callback(new Error('请输入课程概述'))
        } else {
          callback()
        }
      }
    }
  ],
  studentBackground: [{ required: true, trigger: 'blur', message: '请输入学生背景' }],
  video: [{ required: true, trigger: 'blur', message: '请选择上传文件' }],
  cover: [{ required: true, trigger: 'blur', message: '请上传文章封面' }],
  type: [{ required: true, trigger: 'change', message: '请选择课程分类' }]
}

export {
  articleRules,
  articleICRules,
  caseICRules,
  videoRules
}
